Validator
Install
npm i --save @darkwolf/validator
Usage
const validator = require('@darkwolf/validator')
const { Validator } = validator
validator.isNumber(13)
validator.isString(21)
class DarkwolfValidator extends Validator {
constructor() {
super()
}
isAveDarkwolf(value) {
return this.isEqual(value, 'Ave, Darkwolf!')
}
}
Methods
isEqual(value1, value2)
isStrictEqual(value1, value2)
isType(value, type)
isClass(value, name)
isInstance(value, constructor)
isUndefined(value)
isNull(value)
isNil(value)
isObject(value)
isObjectLike(value)
isPlainObject(value)
isFunction(value)
isAsyncFunction(value)
isBoolean(value)
isNumber(value)
isString(value)
isSymbol(value)
isArray(value)
isBuffer(value)
isArrayBuffer(value)
isRegExp(value)
isSet(value)
isMap(value)
isPromise(value)
isDate(value)
isError(value)
isTypeError(value)
isCodeError(value)
isNaN(value)
isFinite(value)
isInteger(value)
isSafeInteger(value)
isFloat(value)
isDecimal(value)
isInfinity(value)
isMore(value, number)
isLess(value, number)
isMoreEqual(value, number)
isLessEqual(value, number)
isRange(value, min, max)
isPositive(value)
isNegative(value)
isNonNegative(value)
isNonPositive(value)
isPositiveInteger(value)
isPositiveFloat(value)
isNegativeInteger(value)
isNegativeFloat(value)
isNonNegativeInteger(value)
isNonNegativeFloat(value)
isNonPositiveInteger(value)
isNonPositiveFloat(value)
isNatural(value)
isPositiveDecimal(value)
isNegativeDecimal(value)
isEven(value)
isOdd(value)
isTrue(value)
isFalse(value)
isRegex(value, RegExp || pattern)
isExists(value)
isEmptyString(value)
isNonEmptyString(value)
isEmptyArray(value)
isNonEmptyArray(value)
isKey(value)
isLength(value, number || ...[min, max] || options[min, max])
isSize(value, number || ...[min, max] || options[min, max])
isEmpty(value)
isHas(value, key)
isIncludes(value, element)
isUnique(value)
isJSON(value)
isJson(value)
isPattern(value)
isTimestamp(value)
isUnixTimestamp(value)
isMillisUnixTimestamp(value)
isUUID(value)
isUuid(value)
isIPv4(value)
isPort(value)
isHTTP(value)
isHttp(value)
isHTTPS(value)
isHttps(value)
isDomain(value)
isURL(value)
isUrl(value)
isDomainURL(value)
isDomainUrl(value)
isEmail(value)
isPhoneNumber(value)
isASCII(value)
isAscii(value)
isBase64(value)
isBase64URL(value)
isBase64Url(value)
isBase58(value)
isJWT(value)
isJwt(value)
isAuthJWT(value)
isAuthJwt(value)
isDarkwolfHash(value)
isDarkwolfUID(value)
isDarkwolfUid(value)
isDarkwolfAuthToken(value)